import { Component } from '@angular/core';
import { NavController, NavParams } from 'ionic-angular';
import { HttpServiceProvider } from '../../providers/http-service/http-service';
import { RegisterPage }  from '../register/register';
import { ForgetPage }    from '../forget/forget';


@Component({
  selector: 'page-login',
  templateUrl: 'login.html',
})
export class LoginPage {

    user:any = {username:'', password:''}

    constructor(public navCtrl: NavController, 
                public navParams: NavParams,
                public http: HttpServiceProvider) {
    }

    login(){
        this.http.login(this.user, (result) => {
            if(result)
              this.navCtrl.setRoot('HomePage')
        })
    }

    register(){
    	this.navCtrl.push(RegisterPage)
    }

    forget(){
      this.navCtrl.push(ForgetPage)
    }

    ionViewDidLoad() {
      console.log('ionViewDidLoad LoginPage');
    }

}
